#include "trap.h"
#include "include/arithmetic_test.h"
    .set noat
   .globl main
   .set noreorder
   .text
main:
   TEST_ADD(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE)
   TEST_ADD_OV(0x7FFFFFFF, 0x00000001, 0x80000000) #OVERFLOW, but overflow exceptional is not implemented
   
   TEST_ADDI(0x0000FFFF, 0x00000001, 0x00010000)
   TEST_ADDI_OV(0x80000000, 0x0000FFFF, 0x7FFFFFFF) #OVERFLOW, but overflow exceptional is not implemented
   
   TEST_ADDU(0xFFFFFFFF, 0x00000001, 0x00000000)
   TEST_ADDU(0x7FFFFFFF, 0x00000001, 0x80000000)

   TEST_ADDIU(0x00000001, 0x0000FFFF, 0x00000000)
   TEST_ADDIU(0x7FFFFFFF, 0x00000001, 0x80000000)
   TEST_ADDIU(0x00000001, 0x00007FFF, 0x00008000)

   TEST_SUB_OV(0x80000000, 0x00000001, 0x7FFFFFFF) #OVERFLOW, but overflow exceptional is not implemented
   TEST_SUB_OV(0x7FFFFFFF, 0xFFFFFFFF, 0x80000000) #OVERFLOW, but overflow exceptional is not implemented
   TEST_SUB(0x12345678, 0x00000001, 0x12345677)

   TEST_SUBU(0x80000000, 0x00000001, 0x7FFFFFFF)
   TEST_SUBU(0x7FFFFFFF, 0xFFFFFFFF, 0x80000000)
   TEST_SUBU(0x12345678, 0x00000001, 0x12345677)

   TEST_SLT(0x80000000, 0x00000001, 0x00000001)
   TEST_SLT(0x00000001, 0x80000000, 0x00000000)
   TEST_SLT(0x00000001, 0x00000002, 0x00000001)
   TEST_SLT(0x00000002, 0x00000001, 0x00000000)
   TEST_SLT(0xFFFFFFFF, 0xFFFFFFF0, 0x00000000)
   TEST_SLT(0xFFFFFFFF, 0x00000000, 0x00000001)
   TEST_SLT(0x00000001, 0x00000001, 0x00000000)

   TEST_SLTI(0x80000000, 0x00000001, 0x00000001)
   TEST_SLTI(0x00000001, 0x0000FFFF, 0x00000000)
   TEST_SLTI(0x12345678, 0x00001234, 0x00000000)
   TEST_SLTI(0x00005678, 0x0000789A, 0x00000001)
   TEST_SLTI(0xFFFFFFFF, 0x00008000, 0x00000000)
   TEST_SLTI(0x80000000, 0x0000FFFF, 0X00000001)
   TEST_SLTI(0x00000001, 0x00000001, 0x00000000)

   HIT_GOOD_TRAP		#stop temu

inst_error:
   HIT_BAD_TRAP

.org 0x384
except:
   eret;